import ChunkFileUploader from './components/ChunkFileUploader'
import ChunkFileUploaderButton from './components/ChunkFileUploaderButton'
import ChunkFileUploaderDrop from './components/ChunkFileUploaderDrop'
import ChunkFileUploaderUnSupport from './components/ChunkFileUploaderUnSupport'
import ChunkFileUploaderList from './components/ChunkFileUploaderList'
import ChunkFileUploaderFiles from './components/ChunkFileUploaderFiles'
import ChunkFileUploaderFile from './components/ChunkFileUploaderFile'

const uploader = {
  version: 1,
  install,
  ChunkFileUploader,
  ChunkFileUploaderButton,
  ChunkFileUploaderDrop,
  ChunkFileUploaderUnSupport,
  ChunkFileUploaderList,
  ChunkFileUploaderFiles,
  ChunkFileUploaderFile
}

if (window && window.Vue) {
  window.Vue.use(install)
}

export default uploader

function install(Vue) {
  if (install.installed) {
    return
  }
  Vue.component(ChunkFileUploader.name, ChunkFileUploader)
  Vue.component(ChunkFileUploaderButton.name, ChunkFileUploaderButton)
  Vue.component(ChunkFileUploaderDrop.name, ChunkFileUploaderDrop)
  Vue.component(ChunkFileUploaderUnSupport.name, ChunkFileUploaderUnSupport)
  Vue.component(ChunkFileUploaderList.name, ChunkFileUploaderList)
  Vue.component(ChunkFileUploaderFiles.name, ChunkFileUploaderFiles)
  Vue.component(ChunkFileUploaderFile.name, ChunkFileUploaderFile)
}
